package com.example.user.feign;

import com.example.common.constant.ServiceNameConstants;
import com.example.common.entity.Result;
import com.example.common.entity.sys.SysDept;
import com.example.common.entity.sys.SysRole;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

import java.util.List;

/**
 * @author cc
 * @classname RemoteRoleDeptService
 * @description TODO
 * @date 2022/8/12 10:54
 */
@FeignClient(value = ServiceNameConstants.SYS_ROLE_DEPT, contextId = "remoteRoleDeptService")
public interface RemoteRoleDeptService {

    /**
     * 通过用户id查询角色信息
     *
     * @return
     */
    @GetMapping("/sys-role/roles/{userId}")
    Result<List<SysRole>> getRolesByUserId(@PathVariable("userId") Long userId);

    /**
     * 通过角色id查询部门信息
     *
     * @return
     */
    @GetMapping("/sys-dept/depts/{roleId}")
    Result<List<SysDept>> getDeptsByRoleId(@PathVariable("roleId") Long roleId);
}
